/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package kimo.persistence.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author a381u296
 */
@Entity
@Table(name = "daok")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Daok.findAll", query = "SELECT d FROM Daok d"),
    @NamedQuery(name = "Daok.findByDaokCd", query = "SELECT d FROM Daok d WHERE d.daokCd = :daokCd"),
    @NamedQuery(name = "Daok.findByDaokName", query = "SELECT d FROM Daok d WHERE d.daokName = :daokName")})
public class Daok implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "daok_cd")
    private String daokCd;
    @Basic(optional = false)
    @Column(name = "daok_name")
    private String daokName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "producerDaokCd")
    private List<Producer> producerList;
    @OneToMany(mappedBy = "userDaokCd")
    private List<User> userList;

    public Daok() {
    }

    public Daok(String daokCd) {
        this.daokCd = daokCd;
    }

    public Daok(String daokCd, String daokName) {
        this.daokCd = daokCd;
        this.daokName = daokName;
    }

    public String getDaokCd() {
        return daokCd;
    }

    public void setDaokCd(String daokCd) {
        this.daokCd = daokCd;
    }

    public String getDaokName() {
        return daokName;
    }

    public void setDaokName(String daokName) {
        this.daokName = daokName;
    }

    @XmlTransient
    public List<Producer> getProducerList() {
        return producerList;
    }

    public void setProducerList(List<Producer> producerList) {
        this.producerList = producerList;
    }

    @XmlTransient
    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (daokCd != null ? daokCd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Daok)) {
            return false;
        }
        Daok other = (Daok) object;
        if ((this.daokCd == null && other.daokCd != null) || (this.daokCd != null && !this.daokCd.equals(other.daokCd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return daokName;
    }
    
}
